import { useEffect } from 'react'
import { useSelector, useDispatch } from 'react-redux'
import { fetchChannelList } from '../reduxStore/modules/asyncData';

function B() {
  // 通过 useSelector钩子函数将store数据映射到组件中
  const { dataList } = useSelector(state => state.asyncReducer)
  const dispatch = useDispatch();
  // 
  useEffect(() => {
    dispatch(fetchChannelList())
  }, [dispatch])

  return (
    <div>
      {
        dataList.map(item => <li>{item.id} {item.name}</li>)
      }
    </div>
  )
}

export default B;